package top.meijhm.communitymanagement.common.error;

public enum ErrorCode {
    NOT_SUCH_OBJECT("000001", "No such Object"),
    OBJECT_CONFLICT("000002", "Object conflict"),
    INPUT_ERROR("001000", "Input fields are illegal, please check."),
    PARAM_CHECK_FAILED("001001", "Param check failed"),
    PASSWORD_CHECK_FAILED("001002", "Wrong password"),
    DATABASE_OP_FAILED("002001", "Database operations failed"),
    // jwt
    JWT_TOKEN_ERROR("003001", "Errors related with jwt token"),
    AUTHENTICATION_FAILED("003002", "Username or password error");

    private String code;
    private String description;

    ErrorCode(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Override
    public String toString() {
        return "ErrorCode{" +
                "code='" + code + '\'' +
                ", description='" + description + '\'' +
                '}';
    }
}